<template>
  <el-drawer
    class="my-drawer-class"
    v-model="isDrawer"
    :with-header="false"
    :before-close="handleClose"
  >
    <div class="title">
      <span>正在播放</span>
      <span>更多歌单</span>
    </div>
    <div class="list">
      <div class="list-item" v-for="item in 12" :key="item">
        <div class="song">
          <span>Awesome</span>
          <el-tag type="info" effect="plain"> SQ </el-tag>
          <el-tag type="info" effect="plain"> MV </el-tag>
        </div>
        <span class="singer">Whitehorse</span>
        <span class="duration">09:48</span>
      </div>
    </div>
  </el-drawer>
</template>

<script setup>
import { ref, watch } from 'vue'
const isDrawer = ref()

const props = defineProps({
  isShowDrawer: {
    type: Boolean,
    default: false
  }
})

const emit = defineEmits({})

// 关闭抽屉
const handleClose = () => {
  isDrawer.value = false
  emit('handleClose')
}

watch(
  () => props.isShowDrawer,
  (val) => {
    isDrawer.value = val
  }
)
</script>

<style lang="scss" scoped>
:global(.my-drawer-class .el-drawer__wrapper) {
  position: absolute;
  top: 50%;
  right: 0;
  height: 50%;
  width: 656px;
  transform: translateY(-50%);
}

.title {
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;

  span {
    font-size: 20px;
    line-height: 28px;
    color: #7d829e;
    &:last-child {
      font-size: 16px;
      line-height: 22px;
    }
  }
}

.list {
  display: flex;
  flex-direction: column;

  .list-item {
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    .song {
      .el-tag {
        border-color: #f56c6c;
        :deep(.el-tag__content) {
          color: #f56c6c;
        }
      }
      span {
        margin-right: 8px;
      }
    }

    .singer {
      font-size: 18px;
      line-height: 25px;
      color: #363d62;
    }

    .duration {
      font-size: 18px;
      line-height: 25px;
      color: #bababd;
    }
  }
}
</style>
